package com.newmainsoftech.dao;

import java.io.File;
import java.text.MessageFormat;

import com.newmainsoftech.eatestutil.container.glassfish.AbstractGlassfishEjbContainerMate;

public class GlassfishEjbContainerMate extends AbstractGlassfishEjbContainerMate {
	private static final String EjbModuleName = "ejb_domain";
		/**
		 * {@inheritDoc} 
		 * @return {@value #EjbModuleName}
		 */
		@Override
		public String getEjbModuleName() {
			return EjbModuleName;
		}
	private final File ModuleStageDir 
	= new File( "target".concat( File.separator).concat( getEjbModuleName()));
		/**
		 * {@inheritDoc} 
		 */
		public File getEjbModuleStageDir() {
			if ( !ModuleStageDir.isDirectory()) {
				throw new IllegalStateException( 
						MessageFormat.format( 
								"Module stage directory should have existed at {0} but not.", 
								ModuleStageDir.getPath()));
			}
			return ModuleStageDir;
		}
	
	private final File DomainXmlFile
	= new File( 
			".".concat( File.separator).concat( "src")
			.concat( File.separator).concat( "test")
			.concat( File.separator).concat( "ee_container")
			.concat( File.separator).concat( "glassfish")
			.concat( File.separator).concat( "domains")
			.concat( File.separator).concat( "domain1")
			.concat( File.separator).concat( "config")
			.concat( File.separator).concat( "domain.xml"));
		/**
		 * {@inheritDoc}
		 */
		@Override
		public File getDomainXmlFile() {
			if ( !DomainXmlFile.isFile()) {
				throw new IllegalStateException( 
						MessageFormat.format( 
								"{0} file does not exist.", DomainXmlFile.getPath()));
			}
			return DomainXmlFile;
		}
}
